package com.tom.compose.service.engin.impl;

import com.tom.compose.model.aggregates.TreeRich;
import com.tom.compose.model.vo.EngineResult;
import com.tom.compose.model.vo.TreeNode;
import com.tom.compose.service.engin.EngineBase;

import java.util.Map;

/**
 * 决策引擎的实现
 *
 * @author zx
 * @date 2024-10-09 20:32
 * @description 决策引擎实现就非常简单,通过传递进来的必要信息:决策树信息、决策物料值做具体的树形结构决策
 */
public class TreeEngineHandle extends EngineBase {
    @Override
    public EngineResult process(Long treeId, String userId, TreeRich treeRich, Map<String, String> decisionMatter) {
        // 决策流程
        TreeNode treeNode = engineDecisionMaker(treeRich, treeId, userId, decisionMatter);
        // 决策结果
        return new EngineResult(userId, treeId, treeNode.getTreeNodeId(), treeNode.getNodeValue());
    }
}
